import {
    GroupCreateFormProp, GroupUpdateFormProp,
    ScriptGroupQueryProp,
    ScriptGroupTableProp,
    ScriptTreeProp,
    ScriptTreeQueryProp
} from "@/pages/script/modules";
import {https} from "@/utils/request";

// ScriptTree 服务分组树
export const scriptTree = (data: ScriptTreeQueryProp): Promise<ScriptTreeProp[]> => {
    return https.request({
        url: '/script/tree',
        method: 'post',
        data: data
    })
}

// scriptGroupList 服务分组查询
export const scriptGroupList = (param: ScriptGroupQueryProp): Promise<ScriptGroupTableProp[]> => {
    return https.request({
        url: '/script/group/list',
        method: 'get',
        params: param
    })
}

// scriptGroupDelete 服务分组删除
export const scriptGroupDelete = (ids: string): Promise<string> => {
    return https.request({
        url: '/script/group/delete',
        method: 'get',
        params: {ids: ids}
    })
}

// scriptGroupCreate 服务分组创建
export const scriptGroupCreate = (data: GroupCreateFormProp): Promise<ScriptTreeProp> => {
    return https.request({
        url: '/script/group/create',
        method: 'post',
        data: data
    })
}


// scriptGroupCreate 服务分组更新
export const scriptGroupUpdate = (data: GroupUpdateFormProp): Promise<ScriptTreeProp> => {
    return https.request({
        url: '/script/group/update',
        method: 'post',
        data: data
    })
}